package cn.openea.perpartner.payment.web.points.controller;

import cn.openea.perpartner.common.core.web.controller.BaseController;
import cn.openea.perpartner.common.core.web.domain.AjaxResult;
import cn.openea.perpartner.payment.web.points.dto.GrowthDto;
import cn.openea.perpartner.payment.web.points.service.IGrowthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author Weird077
 * @description TODO
 * @date 2022-12-14 14:28
 */
@Api(tags = "成长系统")
@RestController
@RequestMapping("/growth")
public class GrowthController extends BaseController {
    @Resource
    private IGrowthService growthService;
    @ApiOperation(value = "增加成长值")
    @PostMapping("/save")
    public AjaxResult save(@RequestBody GrowthDto growthDto) {

        return toAjax(growthService.save(growthDto));
    }
    @ApiOperation(value = "获取成长值")
    @PostMapping("/get")
    public AjaxResult getByUserId(@RequestBody GrowthDto growthDto) {

        return AjaxResult.success("操作成功",growthService.getByUserId(growthDto.getUserId()));
    }

}
